|
|||||||||||||||||||
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
WSCFElement.java | 0% | 0% | 25% | 3.6% |
|
1 |
/*
|
|
2 |
* Copyright 2001-2004 The Apache Software Foundation.
|
|
3 |
*
|
|
4 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5 |
* you may not use this file except in compliance with the License.
|
|
6 |
* You may obtain a copy of the License at
|
|
7 |
*
|
|
8 |
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9 |
*
|
|
10 |
* Unless required by applicable law or agreed to in writing, software
|
|
11 |
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13 |
* See the License for the specific language governing permissions and
|
|
14 |
* limitations under the License.
|
|
15 |
*/
|
|
16 |
package org.apache.geronimo.ews.ws4j2ee.context.webservices.server;
|
|
17 |
|
|
18 |
import org.apache.geronimo.ews.ws4j2ee.context.webservices.server.interfaces.WSCFConstants;
|
|
19 |
import org.w3c.dom.Element;
|
|
20 |
import org.w3c.dom.Node;
|
|
21 |
import org.w3c.dom.NodeList;
|
|
22 |
|
|
23 |
import java.util.Vector;
|
|
24 |
|
|
25 |
/**
|
|
26 |
* This will represent an Element in the WebService.xml configuration file.
|
|
27 |
* EVERY concrete Element class in the configuration file will directly or indirectlt
|
|
28 |
* will extend this class and will show the polymorphic behavior defined here.
|
|
29 |
* The class has been taken from the axis WSDDElement class
|
|
30 |
*/
|
|
31 |
public abstract class WSCFElement implements WSCFConstants { |
|
32 |
|
|
33 | 73 |
public WSCFElement() {
|
34 |
} |
|
35 |
|
|
36 | 0 |
public WSCFElement(Element e) throws WSCFException { |
37 |
//TODO validate for the naspaces and the URIs
|
|
38 |
} |
|
39 |
|
|
40 |
/**
|
|
41 |
* Gets the child element of name <code>name<\code> from the element passed <code>e</code>
|
|
42 |
*
|
|
43 |
* @param e Element
|
|
44 |
* @param name name of the child element to be searched
|
|
45 |
* @return child Element
|
|
46 |
*/
|
|
47 | 0 |
public Element getChildElement(Element e, String name) {
|
48 | 0 |
Element[] elements = getChildElements(e, name); |
49 | 0 |
if (elements.length == 0)
|
50 | 0 |
return null; |
51 | 0 |
return elements[0];
|
52 |
} |
|
53 |
|
|
54 |
/**
|
|
55 |
* Gets the child elements of name <code>name<\code> from the element passed <code>e</code>
|
|
56 |
*
|
|
57 |
* @param e Element
|
|
58 |
* @param name name of the child element to be searched
|
|
59 |
* @return child Elements
|
|
60 |
*/
|
|
61 | 0 |
public Element[] getChildElements(Element e, String name) {
|
62 | 0 |
NodeList nl = e.getChildNodes(); |
63 | 0 |
Vector els = new Vector();
|
64 | 0 |
for (int i = 0; i < nl.getLength(); i++) { |
65 | 0 |
Node thisNode = nl.item(i); |
66 | 0 |
if (!(thisNode instanceof Element)) |
67 | 0 |
continue;
|
68 | 0 |
Element el = (Element) thisNode; |
69 | 0 |
if (el.getLocalName().equals(name)) {
|
70 | 0 |
els.add(el); |
71 |
} |
|
72 |
} |
|
73 | 0 |
Element[] elements = new Element[els.size()];
|
74 | 0 |
els.toArray(elements); |
75 | 0 |
return elements;
|
76 |
} |
|
77 |
} |
|
78 |
|
|